package com.sunfeng.gulimall.ware.dao;

import com.sunfeng.gulimall.ware.entity.WareSkuEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 商品库存
 * 
 * @author sunfeng
 * @email 18354680214@163.com
 * @date 2021-07-17 00:02:19
 */
@Mapper
public interface WareSkuDao extends BaseMapper<WareSkuEntity> {

    /**
     * 添加入库信息
     * @param skuId
     * @param wareId
     * @param skuNum
     */
    void addStock(@Param("skuId") Long skuId, @Param("wareId") Long wareId, @Param("skuNum") Integer skuNum);

    /**
     * 返回值为map 需要指定MapKey
     * @param skuIds
     * @return
     */
    @MapKey("spu_id")
    List<Map<String,Object>> findCountGroupBySkuId(@Param("skuIds") List<Long> skuIds);

}
